package com.weigee.ktv.view.dialog

import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.linde.library.util.DisplayUtil
import com.weigee.ktv.R
import com.weigee.ktv.presenter.PayingReplaceLocationPresenter
import com.weigee.ktv.view.interfaces.PayingReplaceLocationView
import kotlinx.android.synthetic.main.dialog_paying_replace_location.*

/**
 * Created by linde on 2017/6/16.
 * LinDe
 */
class PayingReplaceLocationDialog : BaseDialog(), PayingReplaceLocationView
{
    var presenter: PayingReplaceLocationPresenter? = null

    override fun setDialogStyle(): Int
    {
        return com.linde.library.R.style.DialogStyle_FromBottomToTop
    }

    override fun setGravity(): Int
    {
        return Gravity.BOTTOM
    }

    override fun setMinimumWidth(): Int?
    {
        return DisplayUtil.displayMetrics(context)?.widthPixels
    }

    override fun setMinimumHeight(): Int?
    {
        return DisplayUtil.displayMetrics(context)?.heightPixels
    }

    override fun onCreate(savedInstanceState: Bundle?)
    {
        super.onCreate(savedInstanceState)
        presenter = PayingReplaceLocationPresenter(this)
    }

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View?
    {
        return inflater?.inflate(R.layout.dialog_paying_replace_location, container, false)
    }

    override fun onViewCreated(view: View?, savedInstanceState: Bundle?)
    {
        super.onViewCreated(view, savedInstanceState)
        lv_no_scroll?.adapter = presenter?.lvAdapter
        tv_dialog_dismiss.setOnClickListener { dismiss() }
    }

    override fun onResume()
    {
        super.onResume()
    }

    override fun taskPreview()
    {
    }

    override fun taskCompletely()
    {
    }

    override fun onBackPressed()
    {
        super.onBackPressed()
        dismiss()
    }
}